import java.util.Random;

/**
 * @author 李泽伟
 */
public class Role {
    String name;
    int blood;
    public Role() {
    }
    public Role(String name, int blood) {
        this.name = name;
        this.blood = blood;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getBlood() {
        return blood;
    }
    public void setBlood(int blood) {
        this.blood = blood;
    }
    public void attack(Role role){
        Random rand = new Random();
        int attacks = rand.nextInt(20);
        role.setBlood(role.getBlood()-attacks);
        System.out.println(this.name+"举起拳头打了"+role.getName()+"一下,"+role.getName()+"的血量变为："+role.getBlood());
    }
}
